<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>根据平均分来划分等级</title>
</head>
<body>
    <script>
      var scores = [parseInt(prompt('请输入语文成绩')), parseInt(prompt('请输入数学成绩')),
      parseInt(prompt('请输入英语成绩')),parseInt(prompt('请输入化学成绩')),parseInt(prompt('请输入历史成绩'))]
      var sum = 0; 
      for (i = 0; i<scores.length;i++){
        sum +=scores[i];

      }
    var average = sum / scores.length;
    var grade;
    switch(true){
        case average >= 90:
         grade = '优秀';
         break ;

        case average >= 80:
         grade = '良好';
         break;

         case average >= 70:
         grade = '一般';
         break;

         case average >= 60:
         grade = '较差';
         break;
         default:
         grade = '很差';
    }
    document.write('你的等级是：'+grade);

    </script>
</body>
</html>